static void
add_damage (GdkOffscreenWindow *offscreen,
int x, int y,
- int w, int h)
+ int w, int h,
+ gboolean is_line)
{
GdkRectangle rect;
GdkRegion *damage;
rect.width = w;
rect.height = h;
+ if (is_line)
+ {
+ /* This should really take into account line width, line
+ * joins (and miter) and line caps. But these are hard
+ * to compute, rarely used and generally a pain. And in
+ * the end a snug damage rectangle is not that important
+ * as multiple damages are generally created anyway.
+ *
+ * So, we just add some padding around the rect.
+ * We use a padding of 3 pixels, plus an extra row
+ * below and on the right for the normal line size. I.E.
+ * line from (0,0) to (2,0) gets h=0 but is really
+ * at least one pixel tall.
+ */
+ rect.x -= 3;
+ rect.y -= 3;
+ rect.width += 7;
+ rect.height += 7;
+ }
+
damage = gdk_region_rectangle (&rect);
_gdk_window_add_damage (offscreen->wrapper, damage);
gdk_region_destroy (damage);
xdest, ydest,
width, height);
- add_damage (offscreen, xdest, ydest, width, height);
+ add_damage (offscreen, xdest, ydest, width, height, FALSE);
}
static void
gdk_draw_rectangle (real_drawable,
gc, filled, x, y, width, height);
- add_damage (offscreen, x, y, width, height);
+ add_damage (offscreen, x, y, width, height, !filled);
}
height,
angle1,
angle2);
- add_damage (offscreen, x, y, width, height);
+ add_damage (offscreen, x, y, width, height, !filled);
}
static void
add_damage (offscreen, min_x, min_y,
max_x - min_x,
- max_y - min_y);
+ max_y - min_y, !filled);
}
}
text_length);
/* Hard to compute the minimal size, not that often used anyway. */
- add_damage (offscreen, 0, 0, private->width, private->height);
+ add_damage (offscreen, 0, 0, private->width, private->height, FALSE);
}
static void
text_length);
/* Hard to compute the minimal size, not that often used anyway. */
- add_damage (offscreen, 0, 0, private->width, private->height);
+ add_damage (offscreen, 0, 0, private->width, private->height, FALSE);
}
static void
}
add_damage (offscreen, min_x, min_y,
- max_x - min_x,
- max_y - min_y);
+ max_x - min_x + 1,
+ max_y - min_y + 1,
+ FALSE);
}
}
add_damage (offscreen, min_x, min_y,
max_x - min_x,
- max_y - min_y);
+ max_y - min_y, TRUE);
}
}
/* Hard to compute the minimal size, as we don't know the line
width, and since joins are hard to calculate.
Its not that often used anyway, damage it all */
- add_damage (offscreen, 0, 0, private->width, private->height);
+ add_damage (offscreen, 0, 0, private->width, private->height, TRUE);
}
static void
width,
height);
- add_damage (offscreen, xdest, ydest, width, height);
+ add_damage (offscreen, xdest, ydest, width, height, FALSE);
}
x_dither,
y_dither);
- add_damage (offscreen, dest_x, dest_y, width, height);
+ add_damage (offscreen, dest_x, dest_y, width, height, FALSE);
}